﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Remoting;
using System.Text;

namespace com.cruxomatic.configuration.PasswordManager
{
    public class PasswordManagerFactory
    {
        public static IPasswordManager GetPasswordManager()
        {
            string DLLClassInformation = CruxConfigurationManager.GetClassDetailsForPasswordManager("CruxPasswordProvider");
            string[] DllClassDetails = DLLClassInformation.Split(',');
            string ClassDetails = DllClassDetails[0].Trim();
            string DllDetails = DllClassDetails[1].Trim();

            ObjectHandle objectHandle = Activator.CreateInstance(DllDetails, ClassDetails);
            IPasswordManager passwordManager = (IPasswordManager)objectHandle.Unwrap();
            return passwordManager;
        }
    }
}
